package com.lhh.springcloud.service;

import com.lhh.entity.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @author 李洪豪
 * @Sno 20220301044
 */
@Component
@FeignClient(value = "vipmember-service-nacos-provider",fallback = CustomFallback.class)
//1.解释@FeignClent注解的fallback属性：当服务名为"vipmember-service-nacos-provider"的服务不可用时（如关闭服务），
//若调用该接口的方法则会返回fallback=CustomFallback.class类中我们自定义的结果
//2.使用我们自定义的fallback类时，需要整合sentinel和openfeign，具体配置在yaml文件中
public interface MemberConsumerOpenFeignService {
    //vipmember-service-nacos-provider为10004和10006端口对应的服务名
    //当请求打过来时会发出http:vipmember-service-nacos-provider/member/query/{id}的请求
    @GetMapping("/member/query/{id}")
    public Result queryMemberById(@PathVariable("id") Long id);
}
